package com.example.beikeyigou.login_reg;

import android.graphics.Bitmap;

import java.lang.ref.SoftReference;
import java.util.HashMap;

public class MemoryCache {
    private HashMap<String, Bitmap> cache = new HashMap<String, Bitmap>();

    //获取缓存图片
    public Bitmap get(String path) {
        if(cache.get(path) == null){
            return null;
        } else {
            return cache.get(path);
        }
    }

    //新增缓存
    public void put(String url,Bitmap bitmap) {
        cache.put(url, bitmap);
    }

    //清空缓存
    public void clear() {
        cache.clear();
    }
}
